﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using KPIS.GERP.GHRMS.BLL;
using KPIS.GERP.GHRMS.IBLL;
using Telerik.Web.UI;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class PR_SalaryPromotionBaseConfig : System.Web.UI.Page
    {
        private SsMng ssMng = new SsMng();
        
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["prm_seq"] != null)
                lblPrm_seq.Text = Request.QueryString["prm_seq"].ToString();
            Session["prm_seq"] = lblPrm_seq.Text;

            IncludeJava();

            if (!IsPostBack)            
            {                    
                LoadDataGrid();
            }
            
        }
        public void IncludeJava()
        {
            HtmlGenericControl script = new HtmlGenericControl();
            script.TagName = "script";
            script.Attributes.Add("type", "text/javascript");
            script.Attributes.Add("src", "../../Scripts/jsfunction.js");
            Page.Header.Controls.Add(script);
        }
        private void LoadDataGrid()
        {
            try
            {               
                SalaryPromotionBaseConfigBLL obj = new SalaryPromotionBaseConfigBLL();  

                DataTable dt = null;
                dt = obj.select(int.Parse(lblPrm_seq.Text )); 

                RadGrid2.DataSource = dt;
                RadGrid2.DataBind();
            }
            catch (Exception ex)
            {

            }
        }

        protected void RadGrid2_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            if (e.CommandName == "btnClick")
            {
                return;
            }

            if (e.CommandName == "Delete")
            {
                int prm_base_seq = Convert.ToInt32((e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["prm_base_seq"]);
                SalaryPromotionBaseConfigBLL obj = new SalaryPromotionBaseConfigBLL();
                obj.Delete(prm_base_seq, ssMng.EmpSeqI);  
       
            }
            LoadDataGrid();
        }

        protected void RadGrid2_ItemDataBound(object sender, GridItemEventArgs e)
        {
         

        }
    }
}
